package cn.itcast.crm.service;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import cn.itcast.crm.domain.Customer;
//@Consumes 注释代表的是一个资源可以接受的 MIME 类型。
//@Produces 注释代表的是一个资源可以返回的 MIME 类型。
@Path("/customerservice")
@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_ATOM_XML})
@javax.ws.rs.Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_ATOM_XML})
public interface CustomerService {
	@GET
	@Path("/customer")
	public List<Customer> getCustomerNotunAssociate(@QueryParam("associated") Boolean associated);
	@GET
	@Path("/customer/TelephoneAndPassword")
	public Customer findByTelephoneAndPassword(@QueryParam("telephone")String telephone,@QueryParam("password") String password);
	@POST
	@Path("/customer")
	public Customer saveCustomer(Customer customer);
	@GET
	@Path("/fixedarea/{fid}/customer")
	public List<Customer> getCustomerByFixedId(@PathParam("fid") String fid);
	@PUT
	@Path("/fixedarea/{fid}/customer")
	public void associate(@QueryParam("cids")List<Integer> cids,@PathParam("fid")String fid);
	
	@GET
	@Path("/customer/{telephone}")
	public Customer getbyTelephone(@PathParam("telephone")String telephone);
	@GET
	@Path("/customer/id/{id}")
	public Customer findById(@PathParam("id")Integer id);
	@PUT
	@Path("/customer/{telephone}")
	public void updateCustomer(@PathParam("telephone")String telephone);
}
